﻿
@{
    ViewBag.Title = Model.ResultInfo.CurrentType.TypeName +"-"+Model.ResultInfo.Master.MasterName+ PubConst.SitePrefix;
    Layout = "~/Views/Shared/_Layout.cshtml";
    ViewBag.PageNum = 2;
    var type = Model.ResultInfo.DocType;
    var fist = type.Where(it => it.Level == 1).ToList();
}
@using Infrastructure.ViewModels
@using Infrastructure.Pub;
@using SyntacticSugar
@section css{
    <link href="~/_theme/ueditor/utf8-net/third-party/SyntaxHighlighter/shCoreDefault.css" rel="stylesheet" />
    <link href="~/_theme/css/doc.css" rel="stylesheet" />
}
@section js{
    <script src="~/_theme/ueditor/utf8-net/third-party/SyntaxHighlighter/shCore.js"></script>
    <script type="text/javascript">SyntaxHighlighter.all();</script>
}
@model ResultModel<DocResult>
<div class="layui-main site-inline">
    <div class="site-tree">
        <ul class="layui-tree">
            @if (type.IsValuable() && fist.IsValuable())
            {

                foreach (var item in fist)
                {
                    var itemChildren = type.Where(it => item.Id == it.ParentId).ToList();
                    <li><h2>@item.TypeName</h2></li>
                    foreach (var childItem in itemChildren)
                    {
                        <li class="site-tree-noicon @((Model.ResultInfo.CurrentType.Id==childItem.Id).IIF("layui-this",""))">
                            <a href="@Url.Action("Doc",new { typeId=childItem.Id})"><cite>@childItem.TypeName</cite></a>
                        </li>
                    }
                }
            }
        </ul>
    </div>
    <div class="site-content">
        @if (Model.ResultInfo.DocContent.IsValuable())
        {
            var list = Model.ResultInfo.DocContent.Where(it => it.TypeId == Model.ResultInfo.CurrentType.Id).ToList();
            foreach (var item in list)
            {
                <h1 class="site-h1">@item.Title</h1>
                <div>
                    @if (ViewBag.IsAdmin == true)
                    {
                        <a class="admin-button" target="_blank" href="/AdminSite/DocContent/PageDCAdd?id=@item.Id">管理</a>
                    }
                    @Html.Raw(item.Content)
                </div>
            }
        }
        <span>收藏到朋友圈：</span><div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_qzone" data-cmd="qzone"></a><a href="#" class="bds_tsina" data-cmd="tsina"></a><a href="#" class="bds_tqq" data-cmd="tqq"></a><a href="#" class="bds_renren" data-cmd="renren"></a><a href="#" class="bds_weixin" data-cmd="weixin"></a></div>
        <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdPic":"","bdStyle":"0","bdSize":"16"},"share":{},"image":{"viewList":["qzone","tsina","tqq","renren","weixin"],"viewText":"分享到：","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
    </div>
</div>
<div class="site-tree-mobile layui-hide">
    <i class="layui-icon"></i>
</div>